# Contributor: Iztok Fister, Jr. <iztok@iztok-jr-fister.eu>
# Maintainer: Iztok Fister, Jr. <iztok@iztok-jr-fister.eu>
pkgname=py3-corner
pkgver=2.2.2
pkgrel=2
pkgdesc="Make some beautiful corner plots"
url="https://github.com/dfm/corner.py"
arch="noarch !s390x !ppc64le !riscv64 !loongarch64" # failed tests
license="BSD-2-Clause"
depends="
	python3
	py3-matplotlib
	py3-scipy
	"
makedepends="py3-gpep517 py3-setuptools py3-setuptools_scm py3-wheel"
checkdepends="py3-pytest"
subpackages="$pkgname-pyc"
source="https://github.com/dfm/corner.py/archive/v$pkgver/corner.py-$pkgver.tar.gz"
builddir="$srcdir/corner.py-$pkgver"

case "$CARCH" in
# several test fails on aarch64 | skip for now
aarch64) options="$options !check" ;;
esac

build() {
	export SETUPTOOLS_SCM_PRETEND_VERSION=$pkgver
	gpep517 build-wheel \
		--wheel-dir .dist \
		--output-fd 3 3>&1 >&2
}

check() {
	local _skipped_tests="
		test_title_quantiles_raises
		and not test_titles2
		and not test_titles1
		and not test_title_quantiles
		and not test_pandas
		and not test_title_quantiles_default
		and not test_labels
		and not test_tight
		and not test_extended_overplotting
		and not test_reverse_overplotting
		and not test_hist_bin_factor
		and not test_range_fig_arg
		and not test_color"

	# shellcheck disable=SC2116
	PYTHONPATH=build/lib pytest -k "not $(echo $_skipped_tests)"
}

package() {
	python3 -m installer -d "$pkgdir" \
		.dist/*.whl
}

sha512sums="
c585f293663239307f28878d0f122594a01f34e5abe37e913bacfa4782a8673fc9d396f91467ddeebf5afe1fca289bd96626c0ba1ff9b9f2570079222b09b184  corner.py-2.2.2.tar.gz
"
